const app = getApp()
const util = require('../../utils/util.js')
var lanya = require("../../utils/BLELocker.js")
var base64 = require('../../utils/base64.js')

// 返回处理
const handleRes = (response, fn, url, data, confirmFn) => {
  console.log(url, 'res-->>', response)
  if (response.statusCode == 200) {
    if (response.data.result == 100000) {
      // if (response.data.result == 0) {//todo
      // app.sendLog(url, JSON.stringify(response), JSON.stringify(data));
      wx.reLaunch({
        url: '../index/index',
      })
      return
    } else if ((response.data.result == 0 || response.data.result === undefined) && typeof fn == 'function') {
      // app.sendLog(url, JSON.stringify(response), JSON.stringify(data));//todo 测试日志接口，上线前需要删掉
      fn(response.data)
      return;
    } else if (response.data.result == 1001) {
      wx.showModal({
        title: '温馨提示',
        confirmColor: '#8290DD',
        content: response.data.description,
        success(res) {
          if (res.confirm) {
            console.log('用户点击确定');
            if (confirmFn) {
              confirmFn(true);
            }
          } else if (res.cancel) {
            console.log('用户点击取消');
          }
        }
      })
      return;
    } else {
      if (response.data.description == '存在未巡检的桩') {
        wx.showModal({
          title: '温馨提示',
          confirmColor: '#8290DD',
          content: '存在未巡检的桩，你确定结束巡检吗？',
          success(res) {
            if (res.confirm) {
              console.log('用户点击确定');
              let abs = data
              abs.isForceOver = 1
              console.log(abs)
              lbbService.patrolEnd(abs, function () {
                wx.navigateBack({
                  delta: 1,
                })
              })
              if (confirmFn) {
                confirmFn(true);

              }
            } else if (res.cancel) {
              console.log('用户点击取消');
            }
          }
        })
        return;
      } else {
        wx.showModal({
          title: '温馨提示',
          confirmColor: '#8290DD',
          showCancel: false,
          content: response.data.description
        })
        return;
      }
    }
  } else {
    // app.sendLog(url, JSON.stringify(response), JSON.stringify(data));
    wx.showToast({
      title: '服务' + response.statusCode,
      image: '/images/gantan.png',
      duration: 2500
    })
    return;
  }
}

const handleErr = (error, url, data) => {
  console.log(url, 'error-->>', error)
  wx.showToast({
    title: '请求失败请重试',
    image: '/images/gantan.png',
    duration: 2500
  })
}

const handleRequest = (data, fn, url, confirmFn) => {

  // util.checkTokenOk(app.globalData.header, function () {
  handleRequestCallback(data, fn, url, confirmFn)
  // },url);

}

const handleRequestCallback = (data, fn, url, confirmFn) => {
  wx.showLoading({
    title: '加载中...',
    mask: true
  })

  wx.request({
    url: util.CONST_DATA.OPEN_MOCK ? `${util.CONST_DATA.MOCK_URL}${url}` : `${util.CONST_DATA.BASE_URL}${url}`,
    header: header,
    method: method,
    data: data,
    success: function (response) {
      wx.hideLoading()
      handleRes(response, fn, url, data, confirmFn)
    },
    fail: function (error) {
      wx.hideLoading()
      handleErr(error, url, data)
    }
  })
}


const header = app.globalData.header
const method = 'POST'

const lbbService = {
  // /**
  //  * 获取验证码
  //  */
  // getVerCode: (data, fn) => {
  //   let url = 'ulogin/getpcode'
  //   handleRequest(data, fn, url)
  // },
  // /**
  //  * 登录
  //  */
  // login: (data, fn) => {
  //   let url = 'ulogin/login'
  //   handleRequest(data, fn, url)
  // },
  /**
   * 获取基本配置信息
   */
  getBaseConfig: (data, fn) => {
    let url = 'config_info/list'
    handleRequest(data, fn, url)
  },
  getUserAuthority: (data, fn) => {
    let url = 'district/getUserAuthority'
    handleRequest(data, fn, url)
  },
  getHospitalProblemDetails: (data, fn) => {
    let url = 'district/getHospitalProblemDetails'
    handleRequest(data, fn, url)
  },
  updateHospitalWeight: (data, fn) => {
    let url = 'district/updateHospitalWeight'
    handleRequest(data, fn, url)
  },
  updateHospitalProblems: (data, fn) => {
    let url = '/district/updateHospitalProblems'
    handleRequest(data, fn, url)
  },
  getHospitalInspectionSummary: (data, fn) => {
    let url = 'district/getHospitalInspectionSummary'
    handleRequest(data, fn, url)
  },
  getHospitalProblemsSummary: (data, fn) => {
    let url = 'district/getHospitalProblemsSummary'
    handleRequest(data, fn, url)
  },
  recordInstallersOptions: (data, fn) => {
    let url = 'district/recordInstallersOptions'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院收费规则
   */
  getFeeRule: (data, fn) => {
    let url = 'feeRule/hospital'
    handleRequest(data, fn, url)
  },
  /**
   * 获取设备变更位置的信息
   * 收费规则，设备类型
   */
  getEquChangeInfo: (data, fn) => {
    let url = 'equipment/getEquChangeInfo';
    handleRequest(data, fn, url)
  },

  /**
   * 获取医院巡检反馈列表
   */
  getFeedbackListHospital: (data, fn) => {
    let url = 'feedBack/getInspectionFeedback'
    handleRequest(data, fn, url)
  },
  // 拍照上传
  saveInspectUploadPic: (data, fn) => {
    let url = 'inspectUpload/saveInspectUploadPic'
    handleRequest(data, fn, url)
  },
  // 修改上传
  updateInspectUploadPic: (data, fn) => {
    let url = 'inspectUpload/updateInspectUploadPic'
    handleRequest(data, fn, url)
  },
  // 获取上传图片列表
  getInspectUploadPic: (data, fn) => {
    let url = 'inspectUpload/getInspectUploadPic'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院设备统计
   */
  getLbmInfoByEquIdAndEquType: (data, fn) => {
    let url = 'inspectUpload/getLbmInfoByEquIdAndEquType'
    handleRequest(data, fn, url)
  },

  /**
   * 获取租借记录
   */
  getUseRecord: (data, fn) => {
    let url = 'hospitalInfo/getUseRecord'
    handleRequest(data, fn, url)
  },
  /**
   * 获取个人巡检报告
   */
  getPersonalReports: (data, fn) => {
    let url = 'inspectUser/reports'
    handleRequest(data, fn, url)
  },
  /**
   * 获取巡检报告详情
   */
  getReportCount: (data, fn) => {
    let url = 'inspectUser/reportCount'
    handleRequest(data, fn, url)
  },
  /**
   * 获取当前师傅或师傅列表
   */
  getWorker: (data, fn) => {
    let url = 'api/task/user'
    handleRequest(data, fn, url)
  },
  /**
   * 获取用户任务权限
   */
  getUserPermission: (data, fn) => {
    let url = 'api/task/checkUser'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院的省市区列表
   */
  getCitys: (data, fn) => {
    let url = 'district/query'
    handleRequest(data, fn, url)
  },
  /**
   * 根据省市区获取医院列表
   */
  getHospitalList: (data, fn) => {
    let url = 'district/hospitalList'
    handleRequest(data, fn, url)
  },
  /**
   * 根据省市区获取医院列表
   */
  getBangdingRfid: (data, fn) => {
    let url = 'equipment/bindEquAndRfid'
    handleRequest(data, fn, url)
  },
  /**
   * 根据关键字搜索医院
   */
  getHospitalByKey: (data, fn) => {
    let url = 'district/getHospitalByKey'
    handleRequest(data, fn, url)
  },
  /**
   * 根据关键字搜索医院的锂电池更换情况
   */
  getPileBatteryReplaceInfoBykey: (data, fn) => {
    let url = 'pile/getPileBatteryReplaceInfoBykey'
    handleRequest(data, fn, url)
  },
  /**
   * 是否可以更换锂电池标记
   */
  getLosingPowerFast: (data, fn) => {
    let url = 'pile/getLosingPowerFast'
    handleRequest(data, fn, url)
  },
  /**
   * 获取未分派的医院
   */
  getHospitalLeft: (data, fn) => {
    let url = 'assign/getHospitalList'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院详情
   */
  getHospitalDetail: (data, fn) => {
    let url = 'district/hospitalDetailInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院设备统计
   */
  getHospitalEquip: (data, fn) => {
    let url = 'record/getEquipmentByHospitalId'
    handleRequest(data, fn, url)
  },

  /**
   * 开始某医院的巡检
   */
  startPatrol: (data, fn) => {
    let url = 'inspection/beginPolling'
    handleRequest(data, fn, url)
  },
  // 结束巡检
  patrolEnd: (data, fn) => {
    let url = 'inspection/overInspect'
    handleRequest(data, fn, url)
  },
  /**
   * 完成某医院的巡检
   */
  completeInspect: (data, fn) => {
    let url = 'inspectPile/completeInspect'
    handleRequest(data, fn, url)
  },
  /**
   * 完成某桩位的检查
   */
  completeCheck: (data, fn) => {
    let url = 'inspectPile/completeCheck'
    handleRequest(data, fn, url)
  },

  /**
   * 获取医院isMatch
   */
  getHospitalLngAndLat: (data, fn) => {
    let url = 'pile/getHospitalLngAndLat'
    handleRequest(data, fn, url)
  },

  /**
   * 更新档杆状态
   */
  updatePole: (data, fn) => {
    let url = 'inspectPile/updatePilePoleStatus'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院的巡检报告列表
   */
  getReportsByHos: (data, fn) => {
    let url = 'inspectUser/hospital'
    handleRequest(data, fn, url)
  },



  /**
   * 获取设备租赁记录
   */
  getRentRecord: (data, fn) => {
    let url = 'record/list'
    handleRequest(data, fn, url)
  },
  /**
   * 获取租赁订单跟踪记录
   */
  getOrderRecord: (data, fn) => {
    let url = 'record/getTailRecordByOrderCode'
    handleRequest(data, fn, url)
  },
  /**
   * 变更设备医院、位置
   */
  changeEquipLocation: (data, fn) => {
    let url = 'equipment/changeEquipmentPosition'
    handleRequest(data, fn, url)
  },
  /**
   * 变更桩医院、位置
   */
  changePilePosition: (data, fn) => {
    let url = 'equipment/changePilePosition'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院位置列表
   */
  getPosByHos: (data, fn) => {
    let url = 'district/getPositionByHospitalId'
    handleRequest(data, fn, url)
  },
  /**
   * 添加医院位置
   */
  addPosByHos: (data, fn) => {
    let url = 'district/addPositionByHospitalId'
    handleRequest(data, fn, url)
  },

  /**
   * 获取所有医院
   */
  getMechList: (data, fn) => {
    let url = 'district/mech_list'
    handleRequest(data, fn, url)
  },

  /**
   * 添加设备
   */
  addPileAndEquipment: (data, fn) => {
    let url = 'inspection/addPileAndEquipment'
    handleRequest(data, fn, url)
  },
  /**
   * 获取设备类型
   */
  getEquVer: (data, fn) => {
    let url = 'equipment/getEqtModelName'
    handleRequest(data, fn, url)
  },
  /**
   * 绑定二维码
   */
  replaceBox: (data, fn, confirmFn) => {
    let url = 'equipment/replace_pile'
    handleRequest(data, fn, url, confirmFn)
  },
  /**
   * 垫高9毫米
   */
  setHigher: (data, fn) => {
    let url = 'pile/updateRaisedRfid'
    handleRequest(data, fn, url)
  },
  /**
   * 更换电池
   */
  changeBattery: (data, fn) => {
    let url = 'pile/changeBattery'
    handleRequest(data, fn, url)
  },
  /**
   * 更换电池2
   */
  changePileBattery: (data, fn) => {
    let url = 'pile/changePileBattery'
    handleRequest(data, fn, url)
  },
  /**
   * 更换原厂读卡器
   */
  updateCard: (data, fn) => {
    let url = 'pile/updateOriginRfid'
    handleRequest(data, fn, url)
  },
  /**
   * 替换rfid
   */
  replaceRfid: (data, fn) => {
    let url = 'equipment/replace_rfid'
    handleRequest(data, fn, url)
  },
  /**
   * 贴消磁贴
   */
  updateRfid: (data, fn) => {
    let url = 'equipment/updateEquNoSticker'
    handleRequest(data, fn, url)
  },
  /**
   * rfid不识别
   */
  rfidError: (data, fn) => {
    let url = 'equipment/updateEquNoRfid'
    handleRequest(data, fn, url)
  },
  /**
   * 获取设备详情
   */
  getEquipDetailInfo: (data, fn) => {
    let url = 'equipment/getEquDetailInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取用户使用情况
   */
  getEquipUseInfo: (data, fn) => {
    let url = 'equipment/getEquUseRecord'
    handleRequest(data, fn, url)
  },
  /**
   * 获取equipInfo
   */
  queryEquipByRfid: (data, fn) => {
    let url = 'equipment/queryEquipmentIdByRfid'
    handleRequest(data, fn, url)
  },
  /**
   * 标记为月租
   */
  rentByMonth: (data, fn) => {
    let url = 'equipment/mackByMonth'
    handleRequest(data, fn, url)
  },
  /**
   * 设置月租时长
   */
  monthRent: (data, fn) => {
    let url = 'equipment/mackByMonth'
    handleRequest(data, fn, url)
  },

  /**
   * 更新设备状态
   */
  updateEquStat: (data, fn) => {
    let url = 'equipment/updateEquStat'
    handleRequest(data, fn, url)
  },
  /**
   * 获取丢失分类
   */
  getLoseCategoryList: (data, fn) => {
    let url = 'api/task/getDictByCode'
    handleRequest(data, fn, url)
  },
  /**
   * 更新桩状态
   */
  updatePileStat: (data, fn) => {
    let url = 'equipment/updatePileStat'
    handleRequest(data, fn, url)
  },
  /**
   * 获取桩详情
   */
  getPileDetailInfo: (data, fn) => {
    let url = 'inspectPile/getPileDetailInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取macId
   */
  getMacId: (data, fn) => {
    let url = 'inspection/bluetoothConnect'
    handleRequest(data, fn, url)
  },
  /**
   * 获取QC二维码信息
   */
  getQC: (data, fn) => {
    let url = 'equipment/getPileCodeId'
    handleRequest(data, fn, url)
  },
  /**
   * 批量更新桩状态
   */
  updatePileStatBatch: (data, fn) => {
    let url = 'inspection/updatePileStatBatch'
    handleRequest(data, fn, url)
  },
  /**
   * 批量更新设备状态
   */
  updateEquStatBatch: (data, fn) => {
    let url = 'inspection/updateEquStatBatch'
    handleRequest(data, fn, url)
  },
  /**
   * 批量上线桩
   */
  addPileBatch: (data, fn) => {
    let url = 'inspection/addPileBatch'
    handleRequest(data, fn, url)
  },
  /**
   * 批量上线设备
   */
  addEquBatch: (data, fn) => {
    let url = 'inspection/addEquBatch'
    handleRequest(data, fn, url)
  },
  /**
   * 批量查询桩
   */
  getPileBatch: (data, fn) => {
    let url = 'inspectPile/getBatchPileDetailInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 批量查询设备
   */
  getEquBatch: (data, fn) => {
    let url = 'equipment/getBatchEquDetailInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 用mac获取桩号
   */
  getHpIdByMacId: (data, fn) => {
    let url = 'equipment/getHpIdByMacId'
    handleRequest(data, fn, url)
  },



  /**
   * 获取权限列表
   */
  getAuthList: (data, fn) => {
    let url = 'btn_auth/workbench_btns'
    handleRequest(data, fn, url)
  },

  /**
   * 获取考勤人员
   */
  getMembers: (data, fn) => {
    let url = 'punch/getMasterInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取多角色下人员
   */
  getRolesUsers: (data, fn) => {
    let url = 'punch/getRolesUsers'
    handleRequest(data, fn, url)
  },
  /**
   * 获取当前角色和其拥有的角色ids
   */
  getCurUserHasRoles: (data, fn) => {
    let url = 'punch/getCurUserHasRoles'
    handleRequest(data, fn, url)
  },
  /**
   * 获取所有考勤人员打卡记录
   */
  getAllCardInfo: (data, fn) => {
    let url = 'punch/getAllCardInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取出差类型
   */
  getSignTypes: (data, fn) => {
    let url = 'punch/getBusinessTravelReason'
    handleRequest(data, fn, url)
  },

  /**
   * 出差查询
   */
  getTripList: (data, fn) => {
    let url = 'punch/getPunchCardInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 打卡(带出差类型)
   */
  signTypes: (data, fn) => {
    let url = 'punch/punchCard'
    handleRequest(data, fn, url)
  },
  /**
   * 补卡(带出差类型)
   */
  reSignTypes: (data, fn) => {
    let url = 'punch/insertPatchCard'
    handleRequest(data, fn, url)
  },
  /**
   * 修改打卡：删除医院(带出差类型)
   */
  removeSignHos: (data, fn) => {
    let url = 'punch/removePunchCardDetail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取师傅某天已经打卡的医院
   */
  getTodaySignHos: (data, fn) => {
    let url = 'punch/getPunchCardLeaseLbmInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取师傅是否打卡的标记
   */
  getIsSign: (data, fn) => {
    let url = 'punch/getPunchIsPunchCardMarking'
    handleRequest(data, fn, url)
  },
  /**
   * 打卡
   */
  installCard: (data, fn) => {
    let url = 'punch/installCard'
    handleRequest(data, fn, url)
  },
  /**
   * 补卡
   */
  addCardInfo: (data, fn) => {
    let url = 'punch/addCardInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取自己最近十天的打卡记录
   */
  getRecentCard: (data, fn) => {
    let url = 'punch/getCardInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取自己某月的打卡记录
   */
  getMonthCard: (data, fn) => {
    let url = 'punch/getCardInfoRecord'
    handleRequest(data, fn, url)
  },
  /**
   * 获取打卡记录详情
   */
  getCardInfo: (data, fn) => {
    let url = 'punch/getCardInfoDetail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取出差打卡详情
   */
  getCardDetail: (data, fn) => {
    let url = 'punch/getCardDetailInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取补卡申请列表
   */
  getRepairCard: (data, fn) => {
    let url = 'punch/getRepairCardInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 审批补卡申请
   */
  checkApply: (data, fn) => {
    let url = 'punch/updateRepairCardInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 【001】获取巡检后问题统计页面数据
   */
  getProblemNewStatistics: (data, fn) => {
    let url = 'api/problemNew/statistics'
    handleRequest(data, fn, url)
  },

   /**
   * 【002】获取巡检问题详细统计数据
   */
  getProblemNewDetailData: (data, fn) => {
    let url = 'api/problemNew/detailData'
    handleRequest(data, fn, url)
  },

  /**
   * 获取问题统计列表
   */
  getAllQuestions: (data, fn) => {
    let url = 'feedback/betAllQuestions'
    handleRequest(data, fn, url)
  },
  /**
   * 添加问题反馈
   */
  feedBack: (data, fn) => {
    let url = 'feedBack/addInspectionFeedback'
    handleRequest(data, fn, url)
  },
  /**
   * 查询问题反馈
   */
  queryProblems: (data, fn) => {
    let url = 'feedback/getQuestionInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取反馈问题一级分类
   */
  getFirstTypes: (data, fn) => {
    let url = 'feedback/getQuestionType'
    handleRequest(data, fn, url)
  },
  /**
   * 获取反馈问题二级分类
   */
  getSecondTypes: (data, fn) => {
    let url = 'feedback/getQuestionSubcatalog'
    handleRequest(data, fn, url)
  },
  /**
   * 添加问题反馈
   */
  newProblem: (data, fn) => {
    let url = 'feedback/addFeedbackQuestion'
    handleRequest(data, fn, url)
  },
  /**
   * 获取问题列表
   */
  getProblems: (data, fn) => {
    let url = 'feedback/getFeedbackPending'
    handleRequest(data, fn, url)
  },
  /**
   * 获取待处理问题详情
   */
  getPendingProblemDetail: (data, fn) => {
    let url = 'feedback/getFeedbackPendingDetail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取已处理问题详情
   */
  getProcessedProblemDetail: (data, fn) => {
    let url = 'feedback/getFeedbackProcessedDetail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取控制盒日志
   */
  getPileLog: (data, fn) => {
    let url = 'feedback/getStatisticPileInfoLog'
    handleRequest(data, fn, url)
  },
  /**
   * 处理问题
   */
  handleProblem: (data, fn) => {
    let url = 'feedback/changeFeedbackQues'
    handleRequest(data, fn, url)
  },
  /**
   * 获取人员列表
   */
  getMaintenanceStaff: (data, fn) => {
    let url = 'feedback/getMaintenanceStaff'
    handleRequest(data, fn, url)
  },
  /**
   * 获取安装师傅和代理商
   */
  getMaintainers: (data, fn) => {
    let url = 'feedback/getMaintainUser'
    handleRequest(data, fn, url)
  },
  /**
   * 添加人员
   */
  addStaff: (data, fn) => {
    let url = 'opt_user/add'
    handleRequest(data, fn, url)
  },
  /**
   * 获取系统检测问题列表
   */
  getSysProblems: (data, fn) => {
    let url = 'feedback/systemStaQueDetail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取系统检测问题数量
   */
  getSysProblemCounts: (data, fn) => {
    let url = 'feedback/getPileOrEqueQuestionCounts'
    handleRequest(data, fn, url)
  },
  /**
   * 获取配件列表
   */
  getAccessories: (data, fn) => {
    let url = 'feedback/getAccessories'
    handleRequest(data, fn, url)
  },
  /**
   * 新增配件
   */
  addAccessory: (data, fn) => {
    let url = 'feedback/addAccessory'
    handleRequest(data, fn, url)
  },
  /**
   * 获取库存列表
   */
  getGoods: (data, fn) => {
    let url = 'goods/getGoods'
    handleRequest(data, fn, url)
  },
  /**
   * 更换配件
   */
  replaceParts: (data, fn) => {
    let url = 'feedBack/replaceEquParts'
    handleRequest(data, fn, url)
  },
  /**
   * 获取用户扫码详情
   */
  getScanInfo: (data, fn) => {
    let url = 'pile/getScanCodeInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取用户租借详情
   */
  getRentInfo: (data, fn) => {
    let url = 'pile/getUserLeaseInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取用户归还详情
   */
  getBackInfo: (data, fn) => {
    let url = 'pile/getBackPileInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取轮椅丢失详情
   */
  getLoseInfo: (data, fn) => {
    let url = 'pile/getLoseChairInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取桩的状态变化记录
   */
  getStatRecord: (data, fn) => {
    let url = 'pile/getPileStatsRecord'
    handleRequest(data, fn, url)
  },
  /**
   * 获取桩的插入开关状态
   */
  getSwitchStat: (data, fn) => {
    let url = 'pile/getSwitchStatInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取桩的锁钩开关状态
   */
  getHookStat: (data, fn) => {
    let url = 'pile/getHookStatInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 分派巡检
   */
  assign: (data, fn) => {
    let url = 'assign/addAssignInspection'
    handleRequest(data, fn, url)
  },
  /**
   * 巡检查询
   */
  searchPatrol: (data, fn) => {
    let url = 'assign/getAssignInspectionInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 网关归还记录
   */
  broadcast: (data, fn) => {
    let url = 'broadcast/getBroadcastBackInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取rfid不识别
   */
  getRFIDNoReadInfo: (data, fn) => {
    let url = 'pile/getRFIDNoReadInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取蓝牙连接失败
   */
  getBlueNoConInfo: (data, fn) => {
    let url = 'pile/getBlueNoConInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取弹不开
   */
  getBoxNoEjectInfo: (data, fn) => {
    let url = 'pile/getBoxNoEjectInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取开关故障
   */
  getBoxSwitchInfo: (data, fn) => {
    let url = 'pile/getBoxSwitchInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取锁钩开关故障
   */
  getBoxHookStatInfo: (data, fn) => {
    let url = 'pile/getBoxHookStatInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取开关故障
   */
  getStatusChange: (data, fn) => {
    let url = 'inspectPile/getEquipmentStatChangeInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取95
   */
  get95data: (data, fn) => {
    let url = 'pile/get95Data'
    handleRequest(data, fn, url)
  },
  /**
   * 开锁
   */
  openLock: (data, fn) => {
    let url = 'pile/openLock'
    handleRequest(data, fn, url)
  },

  record95data: (data) => {
    wx.showLoading({
      title: '记录中...',
      mask: true
    })
    let url = "https://www.ejiakanghu.cn/statistic/collect/data";
    wx.request({
      url: url,
      header: header,
      method: method,
      data: {
        data: base64.encode(JSON.stringify(data)),
        dt: '95data',
      },
      success: function (response) {
        wx.hideLoading()
      },
      fail: function (error) {
        wx.hideLoading()
      }
    })
  },

  /**
   * 开锁
   */
  getInspectionStat: (data, fn) => {
    let url = 'inspection/getInspectionStat'
    handleRequest(data, fn, url)
  },


  /**
   * 获取设备下线原因
   */
  getEquipmentOffReason: (data, fn) => {
    let url = 'pile/getEquipmentOffReason'
    handleRequest(data, fn, url)
  },

  /**
   * 获取桩控制盒下线原因
   */
  getEquOfflineReason: (data, fn) => {
    let url = 'pile/getEquOfflineReason'
    handleRequest(data, fn, url)
  },
  /**
   * 获取问题反馈类型（新）
   */
  getFeedbackQuestionTypeInfo: (data, fn) => {
    let url = 'feedback/getFeedbackQuestionTypeInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取客服反馈问题类别
   */
  getFeedbackQuestionTypeCounts: (data, fn) => {
    let url = 'feedback/getFeedbackQuestionTypeCounts'
    handleRequest(data, fn, url)
  },

  /**
   * 根据省市医院问题类型 获取问题反馈
   */
  getFeedbackList: (data, fn) => {
    let url = 'feedback/getFeedbackList'
    handleRequest(data, fn, url)
  },

  /**
   * 查询巡检人员所负责的所有桩位
   */
  getInspectAllPiles: (data, fn) => {
    let url = 'inspectPile/getInspectAllPiles'
    handleRequest(data, fn, url)
  },
  /**
   * 查询巡检人员所负责的所有桩位问题统计数量
   */
  getInspectAllPileCount: (data, fn) => {
    let url = 'inspectPile/getInspectAllPileCount'
    handleRequest(data, fn, url)
  },
  /**
   * 查询巡检人员所负责的所有桩位
   */
  getPageInspectPile: (data, fn) => {
    let url = 'inspectPile/getPageInspectPile'
    handleRequest(data, fn, url)
  },
  /**
   * 连接超时统计
   */
  getBlueSearchTimeoutStatic: (data, fn) => {
    let url = 'pile/getBlueSearchTimeoutStatic'
    handleRequest(data, fn, url)
  },

  /**
   * 获取巡检师傅巡检上下线信息
   */
  getUserReportInfo: (data, fn) => {
    let url = 'inspectUser/getUserReportInfo/v2'
    handleRequest(data, fn, url)
  },

  /**
   * 获取b巡检师傅变更信息
   */
  getUserReportChangeInfo: (data, fn) => {
    let url = 'inspectUser/getUserReportChangeInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 获取处理维修信息
   */
  getUserReportHandleRepairInfo: (data, fn) => {
    let url = 'inspectUser/getUserReportHandleRepairInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 获取处理客服提交问题
   * @param data
   * @param fn
   */
  getQuestionFeedbackInfo: (data, fn) => {
    let url = 'inspectUser/getQuestionFeedbackInfo'
    handleRequest(data, fn, url)
  },

  getChargeBatterInfo: (data, fn) => {
    let url = 'inspectUser/getChargeBatterInfo'
    handleRequest(data, fn, url)
  },
  getUncheckedPileInfo: (data, fn) => {
    let url = 'inspectUser/getUncheckedPileInfo'
    handleRequest(data, fn, url)
  },
  getUncheckedEquInfo: (data, fn) => {
    let url = 'inspectUser/getUncheckedEquInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 获取锂电池更换统计
   */
  getPileBatteryReplaceInfo: (data, fn) => {
    let url = 'pile/getPileBatteryReplaceInfo'
    handleRequest(data, fn, url)
  },
  //仓库列表
  getWarehouseList: (data, fn) => {
    let url = 'stock/getWarehouseList'
    handleRequest(data, fn, url)
  },
  //根据当前人获取其负责的管理仓库列表
  getAdminWarehouses: (data, fn) => {
    let url = 'stock/getAdminWarehouses'
    handleRequest(data, fn, url)
  },

  warehouseItem: (data, fn) => {
    let url = 'stock/warehouseItem'
    handleRequest(data, fn, url)
  },
  saveWarehouse: (data, fn) => {
    let url = 'stock/saveWarehouse'
    handleRequest(data, fn, url)
  },
  //地址列表
  getReceiveAddressList: (data, fn) => {
    let url = 'stock/getReceiveAddressList'
    handleRequest(data, fn, url)
  },
  receiveAddressItem: (data, fn) => {
    let url = 'stock/receiveAddressItem'
    handleRequest(data, fn, url)
  },
  saveReceiveAddress: (data, fn) => {
    let url = 'stock/saveReceiveAddress'
    handleRequest(data, fn, url)
  },
  delReceiveAddress: (data, fn) => {
    let url = 'stock/delReceiveAddress'
    handleRequest(data, fn, url)
  },
  getDefalutAddress: (data, fn) => {
    let url = 'stock/getDefalutAddress'
    handleRequest(data, fn, url)
  },
  //获取仓管人员
  getStockUsers: (data, fn) => {
    let url = 'stock/getStockUsers'
    handleRequest(data, fn, url)
  },
  //获取仓库和第三方
  getWarehouseAndThirdParty: (data, fn) => {
    let url = 'stock/getWarehouseAndThirdParty'
    handleRequest(data, fn, url)
  },
  //单个物品盘点保存
  goodsCheckSingleSave: (data, fn) => {
    let url = 'stock/goodsCheckSingleSave'
    handleRequest(data, fn, url)
  },
  //盘点记录
  goodsCheckList: (data, fn) => {
    let url = 'stock/goodsCheckList'
    handleRequest(data, fn, url)
  },
  //盘点详情
  goodsCheckItem: (data, fn) => {
    let url = 'stock/goodsCheckItem'
    handleRequest(data, fn, url)
  },
  //添加打印
  addFlowPrint: (data, fn) => {
    let url = 'stock/addFlowPrint'
    handleRequest(data, fn, url)
  },

  //物品列表
  getGoodsList: (data, fn) => {
    let url = 'stock/getGoodsList'
    handleRequest(data, fn, url)
  },
  //物品类别
  getGoodsCategoryList: (data, fn) => {
    let url = 'stock/getGoodsCategoryList'
    handleRequest(data, fn, url)
  },
  //物品详情
  goodsItem: (data, fn) => {
    let url = 'stock/goodsItem'
    handleRequest(data, fn, url)
  },
  //保存物品
  saveGoods: (data, fn) => {
    let url = 'stock/saveGoods'
    handleRequest(data, fn, url)
  },
  //获取仓库物品
  getWarehouseGoods: (data, fn) => {
    let url = 'stock/getWarehouseGoods'
    handleRequest(data, fn, url)
  },
  //获取人员拥有物品
  getOwnerGoods: (data, fn) => {
    let url = 'stock/getOwnerGoods'
    handleRequest(data, fn, url)
  },
  //物品仓库出库入库
  accessGoods: (data, fn) => {
    let url = 'stock/accessGoods'
    handleRequest(data, fn, url)
  },
  //获取出入库流水
  getEntryOutLogs: (data, fn) => {
    let url = 'stock/getEntryOutLogs'
    handleRequest(data, fn, url)
  },
  //申请物品
  goodsApply: (data, fn) => {
    let url = 'stock/goodsApply'
    handleRequest(data, fn, url)
  },
  //申请物品基本信息修改保存，关闭和恢复等
  goodsApplyInfoSave: (data, fn) => {
    let url = 'stock/goodsApplyInfoSave'
    handleRequest(data, fn, url)
  },
  /**
   * 编辑某个申请（申请物品）
   **/
  updateApplyInfo: (data, fn) => {
    let url = 'stock/updateApplyInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 编辑待收货的物品
   */
  updateApplyReceivePackage: (data, fn) => {
    let url = 'stock/updateApplyReceivePackage'
    handleRequest(data, fn, url)
  },
  //申请物品列表（师傅查看自己的申请）
  goodsApplyList: (data, fn) => {
    let url = 'stock/goodsApplyList'
    handleRequest(data, fn, url)
  },
  //申请物品详情
  goodsApplyItem: (data, fn) => {
    let url = 'stock/goodsApplyItem'
    handleRequest(data, fn, url)
  },
  //物品申请包裹 确认收货
  goodsApplyPackageReceive: (data, fn) => {
    let url = 'stock/goodsApplyPackageReceive'
    handleRequest(data, fn, url)
  },
  //获取仓库某些物品数量
  getGoodsStockUp: (data, fn) => {
    let url = 'stock/getGoodsStockUp'
    handleRequest(data, fn, url)
  },
  //物品申请备货提交
  goodsApplyDeliveryPackage: (data, fn) => {
    let url = 'stock/goodsApplyDeliveryPackage'
    handleRequest(data, fn, url)
  },
  //包裹基本信息保存，物流信息修改保存
  goodsApplyUpSave: (data, fn) => {
    let url = 'stock/goodsApplyUpSave'
    handleRequest(data, fn, url)
  },
  // 申请物品列表（库管备货查看）
  goodsApplyStockList: (data, fn) => {
    let url = 'stock/goodsApplyStockList'
    handleRequest(data, fn, url)
  },

  // 寄出物品列表(查看自己的)
  goodsSend: (data, fn) => {
    let url = 'stock/goodsSend'
    handleRequest(data, fn, url)
  },
  // 寄出物品列表(查看自己的)
  goodsSendList: (data, fn) => {
    let url = 'stock/goodsSendList'
    handleRequest(data, fn, url)
  },
  // 寄出物品详情
  goodsSendItem: (data, fn) => {
    let url = 'stock/goodsSendItem'
    handleRequest(data, fn, url)
  },
  // 寄出物品确认收货
  goodsSendConfirm: (data, fn) => {
    let url = 'stock/goodsSendConfirm'
    handleRequest(data, fn, url)
  },
  // 代收货列表
  waitReceiveList: (data, fn) => {
    let url = 'stock/waitReceiveList'
    handleRequest(data, fn, url)
  },
  getMasterInfoByUid: (data, fn) => {
    let url = 'stock/getMasterInfoByUid'
    handleRequest(data, fn, url)
  },

  /**
   * 获取网关归还的详情信息
   * @param data
   * @param fn
   */
  getBroadcastBackDetailInfo: (data, fn) => {
    let url = 'broadcast/getBroadcastBackDetailInfo'
    handleRequest(data, fn, url)
  },

  /**
   * 获取pwd
   * @param data
   * @param fn
   */
  getBlePwd: (data, fn) => {
    let url = 'ble/pwd'
    handleRequest(data, fn, url)
  },

  /**
   * 获取pwd
   * @param data
   * @param fn
   */
  getBoxTypes: (data, fn) => {
    let url = 'pile/getPileVer'
    handleRequest(data, fn, url)
  },


  /**
   * 上传工作记录
   * @param data
   * @param fn
   */
  uploadWork: (data, fn) => {
    let url = 'feedback/uploadWork'
    handleRequest(data, fn, url)
  },
  /**
   *  获取电池告警列表
   * @param data 
   * @param fn 
   */
  getBatteryWarningList: (data, fn) => {
    let url = 'battery_statistics/list'
    handleRequest(data, fn, url)
  },
  /**
   *  获取电池列表数量
   * @param data 
   * @param fn 
   */
  getBatteryListCount: (data, fn) => {
    let url = 'battery_statistics/list_count'
    handleRequest(data, fn, url)
  },
  /**
   *  获取电池使用详情
   * @param data 
   * @param fn 
   */
  getBatterySituation: (data, fn) => {
    let url = 'battery_statistics/battery_detail/' + data
    handleRequest(data, fn, url)
  },
  /**
   * 获取所有安装师傅
   * @param {*} data 
   * @param {*} fn 
   */
  getallInstallMaster: (data, fn) => {
    let url = 'battery_statistics/allInstallMaster/'
    handleRequest(data, fn, url)
  },
  /**
   * 获取筛选后的医院列表
   * @param {*} data 
   * @param {*} fn 
   */
  getSearchHospitalList: (data, fn) => {
    let url = 'battery_statistics/getHospitalList/'
    handleRequest(data, fn, url)
  },
  /**
   * 医院首次安装桩数
   * @param {*} data 
   * @param {*} fn 
   */
  getFirstLockCount: (data, fn) => {
    let url = 'battery_statistics/getFirstLockCount/'
    handleRequest(data, fn, url)
  },
  /**
   *  获取Sim卡告警列表
   * @param data 
   * @param fn 
   */
  getSimWarningList: (data, fn) => {
    let url = 'battery_statistics/sim_list'
    handleRequest(data, fn, url)
  },
  /**
   *  获取Sim卡列表数量
   * @param data 
   * @param fn 
   */
  getSimListCount: (data, fn) => {
    let url = 'battery_statistics/sim_list_count'
    handleRequest(data, fn, url)
  },
  /**
   *  获取Sim使用详情
   * @param data 
   * @param fn 
   */
  getSimDetail: (data, fn) => {
    let url = 'battery_statistics/sim_detail/' + data
    handleRequest(data, fn, url)
  },
  getAllInnerUser: (data, fn) => {
    let url = 'work_task/getAllInnerUser/'
    handleRequest(data, fn, url)
  },
  insertTask: (data, fn) => {
    let url = 'work_task/insert_task/'
    handleRequest(data, fn, url)
  },
  updateTask: (data, fn) => {
    let url = 'work_task/update_task/'
    handleRequest(data, fn, url)
  },
  getWorkTaskList: (data, fn) => {
    let url = 'work_task/list/'
    handleRequest(data, fn, url)
  },
  getWorkTaskLogList: (data, fn) => {
    let url = 'work_task/log_list/'
    handleRequest(data, fn, url)
  },
  completeTaskLog: (data, fn) => {
    let url = 'work_task/completeTaskLog/'
    handleRequest(data, fn, url)
  },
  inspectTaskLog: (data, fn) => {
    let url = 'work_task/inspectTaskLog/'
    handleRequest(data, fn, url)
  },

  getHosPutEquTypeList: (data, fn) => {
    let url = 'hospitalInfo/putTypeList'
    handleRequest(data, fn, url)
  },

  //获取投放的医院信息列表
  getPutinHosMarketerList: (data, fn) => {
    let url = 'putinHos/hosList'
    handleRequest(data, fn, url)
  },
  //获取投放医院的基本字典信息
  getPutinBaseDataInfo: (data, fn) => {
    let url = 'putinHos/baseData'
    handleRequest(data, fn, url)
  },
  //获取投放代理信息
  getPutinAgentList: (data, fn) => {
    let url = 'putinHos/agentList'
    handleRequest(data, fn, url)
  },
  //添加代理信息
  putinAddAgentInfo: (data, fn) => {
    let url = 'putinHos/addAgentInfo'
    handleRequest(data, fn, url)
  },
  //更新代理信息
  putinUpdateAgentInfo: (data, fn) => {
    let url = 'putinHos/updateAgentInfo'
    handleRequest(data, fn, url)
  },
  //添加投放医院信息
  putinAddHosMarketerInfo: (data, fn) => {
    let url = 'putinHos/addHosMarketer'
    handleRequest(data, fn, url)
  },
  //更新投放医院信息
  putinUpdateHosMarketerInfo: (data, fn) => {
    let url = 'putinHos/updateHosMarketer'
    handleRequest(data, fn, url)
  },
  //获取网关的设备关系
  getGatewayEquShipList: (data, fn) => {
    let url = 'gatewayEquShip/list'
    handleRequest(data, fn, url)
  },
  //删除网关设备关系
  delGatewayEquShip: (data, fn) => {
    let url = 'gatewayEquShip/del'
    handleRequest(data, fn, url)
  },
  //添加网关设备关系
  addGatewayEquShip: (data, fn) => {
    let url = 'gatewayEquShip/add'
    handleRequest(data, fn, url)
  },
  //上线网关信息
  onlineGateway: (data, fn) => {
    let url = 'gatewayEquShip/onlineGateway'
    handleRequest(data, fn, url)
  },
  //获取医院网关设备信息
  getHosGatewayEquShip: (data, fn) => {
    let url = 'gatewayEquShip/hosGatewayEquList'
    handleRequest(data, fn, url)
  },
  //根据qrcode搜索桩号
  /**
   *  根据qrcode搜索桩号
   * @param data 
   * @param fn 
   */
  postQrcode: (data, fn) => {
    let url = 'scanning/code'
    handleRequest(data, fn, url)
  },
  /**
   * 根据省市月份获取医院任务列表
   */
  getHospitalTaskList: (data, fn) => {
    let url = 'api/task/index'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院运维任务列表
   */
  getHospitalTaskListv2: (data, fn) => {
    let url = 'api/task/index/v2'
    handleRequest(data, fn, url)
  },
  /**
   * 运维长期任务列表
   */
  getLongTaskList: (data, fn) => {
    let url = 'api/task/detail/long'
    handleRequest(data, fn, url)
  },
  /**
   * 运维临时任务列表
   */
  getTemporaryTaskList: (data, fn) => {
    let url = 'api/task/detail'
    handleRequest(data, fn, url)
  },
  /**
   * 获取医院任务数量
   */
  getTaskListNumber: (data, fn) => {
    let url = 'api/task/detail/count'
    handleRequest(data, fn, url)
  },
  /**
   * 运维任务签到
   */
  signIn: (data, fn) => {
    let url = 'api/task/signIn'
    handleRequest(data, fn, url)
  },
  /**
   * 运维任务签到信息详情
   */
  getSignInInfo: (data, fn) => {
    let url = 'api/task/getSignInInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 市场任务签到
   */
  taskMarketSignIn: (data, fn) => {
    let url = 'api/task/taskMarketSignIn'
    handleRequest(data, fn, url)
  },
  /**
   * 市场任务查看签到
   */
  taskMarketSignInInfo: (data, fn) => {
    let url = 'api/task/taskMarketSignInInfo'
    handleRequest(data, fn, url)
  },
  /**
   * 长期任务完成
   */
  TaskItemsOk: (data, fn) => {
    let url = 'api/task/detail/long/end'
    handleRequest(data, fn, url)
  },
  /**
   * 网关已充电
   */
  ChargedOk: (data, fn) => {
    let url = 'api/task/detail/equ/end'
    handleRequest(data, fn, url)
  },
  /**
   * 临时运维任务处理
   */
  HandleOk: (data, fn) => {
    let url = 'api/task/detail/end'
    handleRequest(data, fn, url)
  },
  /**
   * 长期任务详情
   */
  longTaskDetail: (data, fn) => {
    let url = 'api/task/detail/equ'
    handleRequest(data, fn, url)
  },
  /**
   * 获取有任务医院
   */
  cityStatistics: (data, fn) => {
    let url = 'api/task/hospitalCityStatistics'
    handleRequest(data, fn, url)
  },
  /**
   * 市场完成后操作的点击按钮颜色
   * @param {*} data 
   * @param {*} fun 
   */
  operationClick: (data, fun) => {
    let url = 'api/task/market/operationClick';
    handleRequest(data, fun, url)
  },
  /**
   * 医院详情查询周边医院列表
   * @param {*} data 
   * @param {*} fun 
   */
  getRoundIncompleteHosInfo: (data, fun) => {
    let url = 'api/task/getRoundIncompleteHosInfo';
    handleRequest(data, fun, url)
  },
    /**
   * 医院详情查询周边医院列表
   * @param {*} data 
   * @param {*} fun 
   */
  getAllPartsDepreciationNum: (data, fun) => {
    let url = 'api/task/getAllPartsDepreciationNum';
    handleRequest(data, fun, url)
  },
    /**
   * 其他问题数量
   * @param {*} data 
   * @param {*} fun 
   */
  getUnInspectNum: (data, fun) => {
    let url = 'district/getUnInspectNum';
    handleRequest(data, fun, url)
  },
    /**
   * 获取所有未处理问题数量
   * @param {*} data 
   * @param {*} fun 
   */
  getIncompleteProNum: (data, fun) => {
    let url = 'district/getIncompleteProNum';
    handleRequest(data, fun, url)
  },
  /**
   * 获取数据字典列表
   * @param {*} data 
   * @param {*} fun 
   */
  getERPDictByCode:(data, fun) =>{
    let url = 'api/task/getDictByCode';
    handleRequest(data, fun, url)
 },
   /**
   * 医院详情-获取签到列表
   * @param {*} data 
   * @param {*} fun 
   */
  getHospitalSignList: (data, fun) => {
    let url = 'api/task/getHospitalSignList';
    handleRequest(data, fun, url)
  },
  /**
   * 置顶或取消置顶
   * @param {*} data 
   * @param {*} fun 
   */
  handleMechanismTop: (data, fun) => {
    let url = 'district/handleMechanismTop';
    handleRequest(data, fun, url)
  },
  /**
   * 桩位列表-批量修改桩位
   * @param {*} data 
   * @param {*} fun 
   */
  updateBatchPileStat: (data, fun) => {
    let url = 'equipment/updateBatchPileStat';
    handleRequest(data, fun, url)
  },
  /**
   * 待处理需求-待处理数量
   * @param {*} data 
   * @param {*} fun 
   */
  getPendingDemandNum: (data, fun) => {
    let url = 'api/task/marketDesk/getPendingDemandNum';
    handleRequest(data, fun, url)
  },
}


module.exports = lbbService